import json

class E_entity:
    title = None            #标题
    index_num = None        #索引号
    classify = None         #分类
    publisher = None        #发布机关
    gen_date = None         #生成日期
    approval_number = None  #文号
    theme = None            #主题词
    content = None          #内容
    attach = None           #附件

    dict = {}             #本实体的字典
    def __init__(self, header, content):
        self.title = header[0]
        self.index_num = header[1]
        self.classify = header[2]
        self.publisher = header[3]
        self.gen_date = header[4]
        self.approval_number = header[5]
        self.theme = header[6]
        self.content = content
        self.attach_pdf = header[7]
        self.attach_doc = header[8]

        self.dict['title'] = self.title
        self.dict['index_num'] = self.index_num
        self.dict['classify'] = self.classify
        self.dict['publisher']= self.publisher
        self.dict['gen_date']= self.gen_date
        self.dict['approval_number']= self.approval_number
        self.dict['theme']=   self.theme
        self.dict['content']= self.content
        self.dict['attach_pdf'] = self.attach_pdf
        self.dict['attach_doc'] = self.attach_doc
    def toJson(self):
        return json.dumps(self.dict,  default = lambda o:o.__dict__, sort_keys=False, indent=4)

    